<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style type="text/css">
        .gridtable {
            font-family: verdana,arial,sans-serif;
            font-size:11px;
            color:#333333;
            border-width: 1px;
            border-color: #666666;
            border-collapse: collapse;
        }
        .gridtable th {
            border-width: 1px;
            padding: 8px;
            border-style: solid;
            border-color: #666666;
            background-color: #dedede;
        }
        .gridtable td {
            border-width: 1px;
            padding: 8px;
            border-style: solid;
            border-color: #666666;
            background-color: #ffffff;
        }
    </style>
</head>
<body>
    <table width="500px" align="center" class="gridtable">
        <th id="movieId">电影id</th>
        <th id="movieName">电影名称</th>
        <th id="movieRate">电影评分</th>
    </table>
</body>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script>
    var movieId=document.getElementById("movieId");
    var movieName=document.getElementById("movieName");
    var movieIRate=document.getElementById("movieRate");
    $.get("http://localhost:8081/getlist", function(data) {
        var movieList=JSON.parse(data);
        console.log(movieList);
        for(var i=0;i<movieList.length;i++){
            var htmlStr="<tr>"+"<td>"+movieList[i]["movieId"]+"</td>"
                +"<td>"+movieList[i]["movieName"]+"</td>"
                +"<td>"+movieList[i]["movieRate"]?movieList[i]["movieRate"]:"暂无评分"+"</td>"+"</tr>";
            $(".gridtable".append(htmlStr));
        }
    })
</script>
</html>